home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994…tember: Reference Library / Dev.CD Sep 94.toast / Technical Documentation / PCI Information / PCI Developer’s Kit (disk) / Native Drivers / NuDriverSupportLib.h < prev    next >
Encoding:
Text File  |  1994-06-27  |  4.9 KB  |  188 lines  |  [TEXT/MPCC]

  1. //
  2. // The Native PCI Driver Support Service Interface
  3. //
  4.  
  5. #include "NuDrivers.h"
  6.  
  7. ////////////////////////////////////////////////////////////////////////////////
  8. //
  9. //    Some basic declarations used throughout the support lib interface
  10. //
  11.  
  12. typedef    void *            Ref;
  13. typedef    unsigned long    ByteCount;
  14. typedef unsigned long    ItemCount;
  15. typedef unsigned long    OptionBits;
  16. typedef    Ref                LogicalAddress;
  17. typedef    Ref                PhysicalAddress;
  18. typedef    long            OSStatus;
  19.  
  20. typedef unsigned long    IteratorKey;
  21.  
  22. typedef struct DriverInformation {
  23.     DCtlPtr                    theDce;
  24.     NuDriverEntryPointPtr    theDriverEntryPoint;
  25.     DriverDescription         theDescription;
  26. } DriverInformation, *DriverInformationPtr;
  27.  
  28. typedef struct NuDriverIterator
  29. {
  30.     ItemCount            totalDrivers;
  31.     ItemCount            validDrivers;
  32.     IteratorKey            iterationKey;
  33.     DriverInformation    theDrivers [1];
  34. } NuDriverIterator;
  35.  
  36. enum
  37. {
  38.     nilOptions    = 0
  39. };
  40.  
  41. enum
  42. {
  43.     invalidID    = 0
  44. };
  45.  
  46. ///////////////////////////////////////////////////////////////////////////////
  47. //
  48. // IOCommandIsComplete    : The replacement for IODone.
  49. //
  50. //    theID        :    a unique number given to the driver with each IO request.
  51. //    theResult    :    the result to be placed in thePB
  52. //
  53.  
  54. extern OSErr    IOCommandIsComplete        (    IOCommandID        theID,
  55.                                             OSErr            theResult,
  56.                                             Boolean            dequeueBeforeCompletion );
  57.                                     
  58.  
  59. ///////////////////////////////////////////////////////////////////////////////
  60. //
  61. // PoolAllocateResident    : Used to allocate a block of non-pageable memory
  62. // PoolDeallocate        : Used to free an allocated block of memory
  63. //
  64. //    byteSize    :    the number of bytes to allocate
  65. //    clear        :    whether OR not to clear the memory before returning
  66. //    theAddress    :    the memory to free
  67. //
  68.  
  69. extern LogicalAddress    PoolAllocateResident    (    ByteCount        byteSize,
  70.                                                     Boolean            clear);
  71.  
  72. extern OSStatus            PoolDeallocate            (    LogicalAddress    theAddress);
  73.  
  74.  
  75. ///////////////////////////////////////////////////////////////////////////////
  76. //
  77. // CallSecondaryInterruptHandler    : Used to call  a subroutine at SIH-level
  78. // QueueSecondaryInterruptHandler    : Used to queue a subroutine at SIH-level
  79. //
  80. //    theHandler    :    the SIH subroutine
  81. //    p1            :    the first parameter
  82. //    p2            :    the second parameter
  83. //
  84.  
  85. typedef    OSStatus (*SecondaryInterruptHandler) (Ref p1, Ref p2);
  86.  
  87. extern OSStatus CallSecondaryInterruptHandler
  88.                            (SecondaryInterruptHandler    theHandler,
  89.                             Ref                            p1,
  90.                             Ref                            p2);
  91.  
  92. extern OSStatus QueueSecondaryInterruptHandler
  93.                            (SecondaryInterruptHandler    theHandler,
  94.                             Ref                            p1,
  95.                             Ref                            p2);
  96.                             
  97. ///////////////////////////////////////////////////////////////////////////////
  98. //
  99. // LookupDrivers    : Used to call  a subroutine to be executed at SIH-level
  100. //
  101. //    theCount        :    the driver info elements to fill
  102. //    skipCount        :    the number of driver info elements to skip before filling
  103. //    theDrivers        :    the driver elements
  104.  
  105. typedef unsigned short    UnitNumber;
  106.  
  107. extern OSStatus InstallDriver(NuDriverEntryPointPtr        theDriverEntryPoint,
  108.                             DriverDescriptionPtr        theDriverDescription,
  109.                             UnitNumber                    theBeginningUnit,
  110.                             UnitNumber                    theEndingUnit,
  111.                             DCtlPtr                    *    theDriver);
  112.  
  113. extern OSStatus RemoveDriver(DCtlPtr                    theDriver);
  114.  
  115. extern OSStatus LookupDrivers(ItemCount                    theCount,
  116.                             ItemCount                    skipCount,
  117.                             NuDriverIterator        *    theDrivers);
  118.  
  119. ///////////////////////////////////////////////////////////////////////////////
  120. //
  121. // PrepareMemoryForIO    : Used to setup a memory range for an I/O operation
  122. // CheckpointIO            : Used to undo the setup
  123. // SynchronizeIO        : Perform CPU specific IO space memory operation
  124. //
  125. //    (See NuKernel ERS)
  126. //
  127.  
  128. //    For PrepareMemoryForIO and CheckpointIO
  129.  
  130. typedef Ref        AddressSpaceID, IOPreparationID;
  131.  
  132. enum
  133. {
  134.     currentAddressSpaceID    = 0
  135. };
  136.  
  137. typedef    OptionBits    IOPreparationOptions;
  138. enum
  139. {
  140.     ioIsInput                = 0x00000001,
  141.     ioIsOutput                = 0x00000002,
  142.     ioAddressIsLogical        = 0x00000004,
  143.     ioCoherentDataPath        = 0x00000008,
  144.     ioTransferIsLogical        = 0x00000010
  145. };
  146.  
  147. typedef struct LogicalAddressRange
  148. {
  149.     LogicalAddress            theAddress;
  150.     ByteCount                theCount;
  151. } LogicalAddressRange;
  152.  
  153. typedef struct AddressRange
  154. {
  155.     PhysicalAddress            thePhysicalAddress;
  156.     LogicalAddress            theStaticLogicalAddress;
  157.     ByteCount                theCount;
  158. } AddressRange;
  159.         
  160. typedef struct MappingTable
  161. {
  162.     AddressSpaceID            addressSpace;
  163.     LogicalAddressRange        logical;
  164.     ItemCount                tableEntryCount;
  165.     AddressRange            rangeEntries [1];
  166. } MappingTable;
  167.  
  168. typedef    OptionBits    IOCheckpointOptions;
  169. enum
  170. {
  171.     nextIsInput                = 0x00000001,
  172.     nextIsOutput            = 0x00000002,
  173.     moreTransfers            = 0x00000004
  174. };
  175.  
  176. extern OSStatus PrepareMemoryForIO       (AddressSpaceID                theAddressSpace,
  177.                                         Ref                            theBase,
  178.                                         ByteCount                    theLength,
  179.                                         IOPreparationOptions        theOptions,
  180.                                         ItemCount                    theEntryCount,
  181.                                         MappingTable *                theMappingTable,
  182.                                         IOPreparationID *            thePreparationID);
  183.  
  184. extern OSStatus CheckpointIO           (IOPreparationID                thePreparationID,
  185.                                         IOCheckpointOptions            theOptions);
  186.  
  187. extern void SynchronizeIO                   ();
  188.